Skip to content

Graphics: add IGT msm_* GPU validation suites - #685

Open
Vignan Jitta (VignanQC) wants to merge 2 commits into
qualcomm-linux:mainfrom
VignanQC:graphics-igt-msm-validation
Open

Vignan Jitta (VignanQC) wants to merge 2 commits into
qualcomm-linux:mainfrom
VignanQC:graphics-igt-msm-validation

Conversation

@VignanQC

Copy link
Copy Markdown

Add msm_bo, msm_mapping, msm_perfcntrs, msm_recovery, msm_submit and msm_submitoverhead suites.

Add Runner/utils/lib_igt.sh as the shared runner.

Signed-off-by: Jitta Vignan jvignan@qti.qualcomm.com


DEFAULT_TIMEOUT=600

igt_msm_run_suite "$TESTNAME" "$SCRIPT_DIR" "$DEFAULT_TIMEOUT" "$@"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please preserve the GPU debugfs state around the recovery test. The native hangcheck implementation selected by the OE 2.6 recipe writes disable_err_irq=Y and restores it only after do_hang_test() returns. A timeout, signal or assertion failure can bypass that restoration, changing hardware fault detection for subsequent CI tests.

Snapshot the original value for the GPU actually selected by IGT, then restore and verify it after owned processes have stopped on success, failure and interruption. Current main's test_result_finish supports TEST_RESULT_CLEANUP, so reuse that lifecycle after rebasing and retain signal cleanup. I did not find an existing GPU error-interrupt snapshot/restore helper in lib_display.sh, so add a small reusable operation there rather than hardcoding a DRM card index or resetting blindly to N.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The state snapshot/restore helpers are now present, but cleanup() still calls display_gpu_err_irq_restore when managed_timeout_cancel_bounded reports that IGT processes remain alive. A surviving worker can change the GPU again after restoration, and the restore helper has already removed the saved state. Return failure before restoring when cancellation fails, retain the state file, and restore only after the owned processes are confirmed stopped.

Comment thread Runner/utils/lib_igt.sh Outdated

log_info "Using IGT binary, $IGT_BIN"
log_info "Launching $* with timeout ${IGT_RUN_TIMEOUT}s"
run_with_managed_timeout "$IGT_RUN_TIMEOUT" "$igt_run_dir" "$igt_run_name" "$@" >"$igt_run_log" 2>&1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs the current shared timeout implementation and owned-process-group cleanup. At this PR's base, run_with_managed_timeout waits unconditionally after signalling the single child, so a process blocked in GPU kernel I/O can outlive the advertised timeout. Also, native msm_recovery forks 20 workers for gpu-fault-parallel. Killing only its parent on escalation does not guarantee those workers stop before the next suite.

Rebase onto main and reuse run_with_managed_timeout with its opt-in MANAGED_TIMEOUT_USE_SESSION=1 and managed_timeout_cancel_bounded, checking for image-provided setsid. Preserve cleanup ownership and the init_env stdout handler. Exercise timeout/interruption with a TERM-resistant child and surviving worker before relying on this in CI.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new flags are set, but this branch still contains the older functestlib.sh, which ignores MANAGED_TIMEOUT_USE_SESSION and TEST_RESULT_CLEANUP. Thus forked workers are not owned as a group, and the result is written before the EXIT trap attempts restoration, whose failure is ignored. Rebase onto current main to bring in those existing implementations, then validate the exact rebased head for timeout, surviving workers and restoration failure before publishing PASS.

Comment thread Runner/utils/lib_igt.sh Outdated
else
cp "$igt_run_dmesg_dir/post/dmesg_errors.log" "$igt_run_new_errors" 2>/dev/null || : >"$igt_run_new_errors"
fi
if [ -s "$igt_run_new_errors" ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All newly captured kernel errors are only warnings, and none can affect the final verdict. A local fixture with native SUCCESS/rc=0 plus a new attributed Adreno Oops still produces PASS. The current line filter can also miss a BUG/Oops header whose GPU attribution appears in the following stack.

Keep the expected invalid-ioctl and deliberate mapping/recovery fault messages non-fatal, but fail genuine new GPU kernel crash blocks. Reuse scan_dmesg_errors for capture and current main's kernel_log_filter_faults on the retained snapshots for attribution, comparing against the baseline. Do not make every ERROR line fatal, since these native tests intentionally generate some of them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new igt_kernel_log_compare calls kernel_log_filter_faults, but that helper is absent from this branch. The suppressed command failure and || : >... fallback turn a captured GPU Oops into zero faults. Include the existing helper by rebasing, and propagate scanner errors as diagnostic failures/unavailable evidence rather than treating them as a clean scan.

Comment thread Runner/utils/lib_igt.sh Outdated
log_info "IGT version, ${igt_run_version:-unknown}"
log_info "IGT log, $igt_run_log"

scan_dmesg_errors "$igt_run_dmesg_dir/post" "$igt_run_dmesg_modules" "$igt_run_dmesg_exclude" >/dev/null 2>&1 || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please distinguish unavailable kernel logs from a clean capture. scan_dmesg_errors creates empty artifacts and returns 1 both for clean logs and for inaccessible logs, with DMESG_ACCESS_STATUS carrying the distinction. Suppressing its output and ignoring that status makes this path print No new msm/adreno/drm kernel errors even when both captures were denied, which I reproduced locally.

Save and check the pre/post DMESG_ACCESS_STATUS and access-artifact paths. Report an explicit evidence-unavailable warning when capture failed, and only report a clean kernel check when both snapshots are usable. Keep the native IGT verdict separate from this diagnostic limitation.

Comment thread Runner/utils/lib_igt.sh Outdated

# igt_msm_run_suite <test-name> <test-dir> <default-timeout> [args...]
# Run one IGT msm_* binary and write the testcase result.
igt_msm_run_suite() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep suite sequencing and verdict ownership in each run.sh. This function currently owns argument parsing, prerequisites, traps, execution, diagnostics, PASS/FAIL/SKIP decisions and process exit, leaving every runner as a one-line dispatcher. That departs from the repository's runner/library split.

An IGT-specific helper file can be justified for six consumers, but limit it to reusable discovery/execution/parsing operations that return evidence/status. Keep named CLI parsing, cleanup ownership and final decisions in the runner. Reuse pkg_detect_os_id from lib_pkg_provider.sh instead of the /etc/os-release parser, and call test_result_record/test_result_finish directly instead of adding igt_msm_finish. When restructuring, keep shared-helper changes and suite integration in separate signed-off commits.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reorganize the two commits before merge, preserving shared-helper changes before their suite consumers. b66c418 is titled Graphics: address review comments for IGT msm suites, which describes the review process rather than the runner, fault-checking and restoration changes. Fold those corrections into the appropriate commits with these subjects:

  • utils: add reusable IGT execution and GPU state helpers
  • Graphics: add six IGT msm validation suites

Keep both intermediate commits usable and retain the existing DCO sign-offs.

Comment thread Runner/utils/lib_display.sh Outdated
Comment on lines +6577 to +6581
dmgdd_dir="/sys/kernel/debug/dri/$dmgdd_minor"
case "$(cat "$dmgdd_dir/name" 2>/dev/null)" in
msm\ *|msm)
printf '%s\n' "$dmgdd_dir"
return 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes the first MSM primary node is the GPU selected by IGT. However, igt_msm_dev_open() opens a render node, and IGT also honors device filters from IGT_DEVICE/.igtrc. With a different selected GPU, this saves/restores the wrong device or warns and runs without a snapshot. Resolve the same device for execution and restoration, enhancing the DRM node mapping in lib_display.sh where needed, and do not run the state-changing hangcheck until that device's original value is saved.

Comment thread Runner/utils/lib_igt.sh Outdated
IGT_KLOG_MODULES='msm[^:]*|adreno[^:]*|\[drm'
# IGT writes its own "[IGT] <test>: starting/finished subtest" markers to the kernel log.
IGT_KLOG_EXCLUDE='dummy regulator|supply [^ ]+ not found|using dummy regulator|\[IGT\] '
IGT_KLOG_FAULT_MODULES='msm|adreno|a[0-9]xx_|drm_'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unqualified msm pattern also attributes unrelated Qualcomm driver faults to the GPU. With the shared scanner from main, a WARNING containing msm_pinctrl_irq_handler is counted as a GPU fault, so a successful IGT run becomes FAIL because of a pinctrl event. Keep kernel_log_filter_faults, but match the DRM module token and specific GPU/DRM symbols rather than any occurrence of msm, with checks for both unrelated faults and genuine built-in/modular GPU faults.

Comment on lines +113 to +119
TESTNAME="msm_bo"
RES_FILE="$SCRIPT_DIR/$TESTNAME.res"
test_result_init "$TESTNAME" "$RES_FILE" || exit 1

if ! cd "$SCRIPT_DIR"; then
test_result_finish FAIL "$TESTNAME FAIL - cannot enter $SCRIPT_DIR"
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All six runners force result/log/state files into the source directory and change to it, despite the CWD output convention. Invoking an installed or read-only Runner from a writable working directory can therefore fail to publish a result, while init_env puts stdout in the original working directory. Capture the invocation directory and use it consistently for results and artifacts, keeping SCRIPT_DIR for locating the repository and helpers.

# display_drm_driver_name <dev-node>
# Print the DRM driver name of the device that owns dev-node, for example msm.
display_drm_driver_name() {
for dddn_dir in $(display_drm_debugfs_dirs "$1"); do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Driver identification depends entirely on readable debugfs, so a usable MSM render node becomes SKIP in all six runners (or FAIL with explicit IGT_DEVICE) when debugfs is disabled or inaccessible. Make this helper identify the DRM driver independently of debugfs, retaining debugfs prerequisites only for native tests/subtests that actually need them.

log_info "GPU error-interrupt state saved, $(sed -n 's/^path=//p' "$ERR_IRQ_STATE")=$(sed -n 's/^value=//p' "$ERR_IRQ_STATE")"
;;
1)
test_result_finish FAIL "$TESTNAME FAIL - disable_err_irq is unavailable for $IGT_DEVICE_NODE, state-changing tests are not run"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only native hangcheck requires disable_err_irq, but this fails even --subtest gpu-fault when that optional control is absent. Limit snapshot/restoration requirements to execution that can change the control, preserve native hangcheck SKIP when absent, and allow the other supported recovery subtests to run.


IGT_LOG="$WORK_DIR/${TESTNAME}_log.txt"
KLOG_DIR="$WORK_DIR/dmesg"
rm -rf "$KLOG_DIR"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All six runners delete the same $WORK_DIR/dmesg, so running different suites from one working directory erases earlier diagnostics and concurrent runs mix evidence. Use test_create_run_directory from functestlib.sh for suite/invocation-specific diagnostic directories while keeping the expected .res file in CWD.

Comment thread Runner/utils/lib_igt.sh
@@ -0,0 +1,190 @@
#!/bin/sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current permission check fails because this new shell file is tracked as 100644. Set its Git executable bit with git update-index --chmod=+x -- Runner/utils/lib_igt.sh.

@VignanQC Vignan Jitta (VignanQC) Nov 26, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, updated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, lib_igt.sh is now executable. At 43e2e291, Runner/utils/lib_display.sh and Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh are tracked as 100644, so the permissions checker still fails and recovery's ./run.sh invocation cannot start. Please restore 100755 on both files.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored 100755 on both.

metadata:
name: msm_bo
format: "Lava-Test Test Definition 1.0"
description: "Validates msm GEM buffer object allocation, mmap and CPU access. Uses the IGT msm_bo test."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The public IGT 2.6 msm_bo source checks allocation/information but never maps a BO or verifies CPU data. Please align this description and the README, or identify the packaged source that supplies those assertions, since the sample reports 51 subtests while that source defines 16.

metadata:
name: msm_perfcntrs
format: "Lava-Test Test Definition 1.0"
description: "Validates the msm GPU performance counter interface. Uses the IGT msm_perfcntrs test."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional coverage follow-up: native msm_perfcntrs checks reservations and conflicts, but never reads samples, so broken stream delivery can still pass. Consider a separate capability-gated test for bounded sample delivery and workload-related counter progress, using the selected counter semantics, and keep this suite described as configuration/allocation coverage.

Signed-off-by: Jitta Vignan <jvignan@qti.qualcomm.com>
Signed-off-by: Jitta Vignan <jvignan@qti.qualcomm.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smuppand

Copy link
Copy Markdown
Contributor

Could you confirm how the required IGT binaries are provided on supported images?

  • Debian/Ubuntu ARM64: Which APT repository and package supplies all six msm_* tests? The standard packages inspected are x86-only.
  • Yocto: The current meta-qcom OE-core pin selects IGT 2.6 (916c79cf), which already contains these six upstream tests. Does your validation use that revision or additional patches, particularly for the extra bo-map-* subtests? Please identify the nightly/image providing the validated binaries and, if an IGT update is needed, link the recipe/SRCREV change and expected availability.

@github-actions

Copy link
Copy Markdown

Test run workflow

Test jobs for commit 18a6158db27214ca49d9c0a2ac4827bb41607df8

Result: Needs attention

PR tests only

meta-qcom-main (base)

Unique PR tests: 6 | Targets: 9 | Testcase results: 42

Pass: 0 | Fail: 0 | Skip: 42

meta-qcom-main (overlay)

Unique PR tests: 6 | Targets: 9 | Testcase results: 48

Pass: 0 | Fail: 0 | Skip: 48

Test glymur-crd (base) glymur-crd (overlay) iq-8275-evk (base) iq-8275-evk (overlay) iq-9075-evk (base) iq-9075-evk (overlay) iq-x7181-evk (base) iq-x7181-evk (overlay) kaanapali-mtp (base) kaanapali-mtp (overlay) qcs8300-ride-sx (base) qcs8300-ride-sx (overlay) qcs9100-ride-sx (base) qcs9100-ride-sx (overlay) rb1-core-kit (base) rb1-core-kit (overlay) rb3gen2-core-kit (base) rb3gen2-core-kit (overlay)
msm_bo 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🔴 ERROR
msm_mapping 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🔴 ERROR
msm_perfcntrs 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🔴 ERROR
msm_recovery 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🔴 ERROR
msm_submit 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🔴 ERROR
msm_submitoverhead 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🟡 SKIP 🔴 ERROR 🔴 ERROR

Setup or workflow errors are recorded in diagnostics.md in the workflow artifacts.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants